﻿/* 4. Sort 3 real values in descending order using nested if statements. */

using System;

public class SortInDescendingOrder
{
    public static void Main()
    {
        double first, second, third;

        Console.Write("First number = ");
        first = double.Parse(Console.ReadLine());
        Console.Write("Second number = ");
        second = double.Parse(Console.ReadLine());
        Console.Write("Third number = ");
        third = double.Parse(Console.ReadLine());
        Console.WriteLine("------------");

        if (first < second)
        {
            first += second;
            second = first - second;
            first -= second;

            if (second < third)
            {
                second += third;
                third = second - third;
                second -= third;

                if (first < second)
                {
                    first += second;
                    second = first - second;
                    first -= second;
                }
            }
        }
        else
        {
            if (second < third)
            {
                second += third;
                third = second - third;
                second -= third;

                if (first < second)
                {
                    first += second;
                    second = first - second;
                    first -= second;
                }
            }
        }

        Console.WriteLine("These in descending order: {0}, {1}, {2}.", first, second, third);
    }
}